import com.cult3d.*;
import java.lang.Thread.*;
import com.cult3d.device.*;

public class ListenLeftClick extends Thread implements Cult3DScript
{
	public static int SLEEP_TIME = 18;
	private volatile boolean stillGoing = true;
	public void run()
	{
		MouseDevice mouse=new MouseDevice();
		int mouseStatus = MouseDevice.NONE;
		while(stillGoing)
		{
			if(mouse.getMouseButtonState()==MouseDevice.LEFT && mouseStatus!=MouseDevice.LEFT)
			{
				Cult.sendMessageToHost("CLICK:Left");
			}
			mouseStatus=mouse.getMouseButtonState();
			try
			{
				Thread.sleep(SLEEP_TIME);
			} catch (Exception e) {}
		}
	}
	
	public void cult3dDestroy()
	{
		System.out.println("Entererd cult3dDestroy()");
		stillGoing = false;
	}
}